-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use rwmutex instead of mutex #5732
Conversation
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 1 file changed, 32 insertions(+), 13 deletions(-)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change sources_lock to sourcesLock and similar for configs_lock, but looks fine other than that
@@ -231,15 +235,18 @@ func getCachedConfig(ctx context.Context, d *schema.ResourceData, configureFunc | |||
return false | |||
}) | |||
config.client.Transport = rec | |||
mutex.Lock() | |||
configs_lock.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe camelCase is the style guideline for golang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I'll do that!
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 1 file changed, 32 insertions(+), 13 deletions(-)) |
mutex
was added in #5722 to fixconcurrent map writes error
in new vcr test. However it still constantly ran intoconcurrent map read and write
error, as the previous only add the lock when write data to the map. Therefore, in this PRrwmutex
instead ofmutex
for better efficiency (which enables concurrent read access, just not concurrent read/write or write/write access)If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)